package exemplo.teste;

import java.sql.SQLException;
import java.util.List;
import junit.framework.Assert;
import org.junit.Test;

import exemplo.database.LoginDAO;
import exemplo.model.Login;

public class LoginDAOTest {

	@Test
	public final void testValidateUser() throws SQLException, ClassNotFoundException {
		System.out.println("validateUser");
		String username = "vinicius";
		String password = "vinicius";
		LoginDAO instance = new LoginDAO();
		boolean expResult = true;
		boolean result = instance.validateUser(username, password);
		Assert.assertEquals(expResult, result);
	}

	@Test
	public final void testGetById() throws SQLException, ClassNotFoundException {
		System.out.println("getById");
		int userId = 2;
		LoginDAO instance = new LoginDAO();
		Login result = instance.getById(userId);
		Assert.assertNotNull(result);	
	}

	@Test
	public final void testGetUsers() throws SQLException, ClassNotFoundException {
		System.out.println("getUsers");
		LoginDAO instance = new LoginDAO();
		List<Login> result = instance.getUsers();
		Assert.assertTrue(result.size() == 2);
	}
}
